package com.blog.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.blog.service.entity.Img;
import com.blog.service.inter.ImgService;
import com.blog.service.model.ImgMapper;

/**
 * 文件名： com.blog.service.impl.ImgServiceImpl.java
 * 作者： WenBin
 * 日期： 2017年4月12日
 * 功能说明：图片服务类
 * =========================================================
 * 修改记录：
 * 修改作者 日期 修改内容
 * =========================================================
 * Copyright (c) 2010-2011 .All rights reserved.
 */
@Service
public class ImgServiceImpl implements ImgService {

	@Autowired
	private ImgMapper imgMapper;

	@Override
	public Img saveImg(Img img) {

		int i = imgMapper.insertSelective(img);
		if (i > 0) {
			return img;
		}
		return null;
	}

	@Override
	public Img updateImg(Img img) {

		int i = imgMapper.updateByPrimaryKey(img);
		if (i > 0) {
			return img;
		}
		return null;
	}

	@Override
	public Img deleteImg(Img img) {

		int i = imgMapper.deleteByPrimaryKey(img.getImgId());
		if (i > 0) {
			return img;
		}
		return null;
	}

}
